:root {
        --primary-color: #3498db;
        --secondary-color: #2ecc71;
        --danger-color: #e74c3c;
        --warning-color: #f39c12;
        --dark-bg: #2c3e50;
        --light-bg: #ecf0f1;
        --card-light: #ffffff;
        --card-dark: #34495e;
        --text-light: #2c3e50;
        --text-dark: #ecf0f1;
        --border-light: #bdc3c7;
        --border-dark: #7f8c8d;
      }

      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
      }

      body {
        background-color: var(--light-bg);
        color: var(--text-light);
        transition: background-color 0.3s, color 0.3s;
      }

      body.dark-mode {
        background-color: var(--dark-bg);
        color: var(--text-dark);
      }

      .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
      }

      /* Header Styles */
      header {
        background-color: var(--card-light);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 15px 0;
        position: sticky;
        top: 0;
        z-index: 100;
        transition: background-color 0.3s;
      }

      body.dark-mode header {
        background-color: var(--card-dark);
      }

      .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      .logo {
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .logo h1 {
        font-size: 1.5rem;
        font-weight: 600;
      }

      .logo-icon {
        color: var(--primary-color);
        font-size: 1.8rem;
      }

      .header-controls {
        display: flex;
        align-items: center;
        gap: 15px;
      }

      .mqtt-status {
        padding: 5px 10px;
        border-radius: 20px;
        font-size: 0.85rem;
        background-color: #f8d7da;
        color: #721c24;
      }

      .mqtt-status.connected {
        background-color: #d4edda;
        color: #155724;
      }

      .theme-toggle {
        background: none;
        border: none;
        cursor: pointer;
        font-size: 1.5rem;
        color: var(--text-light);
        display: flex;
        align-items: center;
        justify-content: center;
      }

      body.dark-mode .theme-toggle {
        color: var(--text-dark);
      }

      /* Navigation Styles */
      nav {
        background-color: var(--card-light);
        border-radius: 10px;
        margin: 20px 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        transition: background-color 0.3s;
      }

      body.dark-mode nav {
        background-color: var(--card-dark);
      }

      .nav-list {
        display: flex;
        list-style: none;
        overflow-x: auto;
      }

      .nav-item {
        padding: 15px 20px;
        cursor: pointer;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 8px;
        transition: background-color 0.2s;
      }

      .nav-item:hover {
        background-color: rgba(52, 152, 219, 0.1);
      }

      .nav-item.active {
        color: var(--primary-color);
        border-bottom: 3px solid var(--primary-color);
      }

      .nav-icon {
        font-size: 1.2rem;
      }

      /* Main Content Styles */
      main {
        padding: 20px 0;
      }

      .dashboard {
        display: none; /* Hide all tabs by default */
      }

      .dashboard.active {
        display: block; /* Show active tab */
      }

      .section-title {
        margin-bottom: 20px;
        font-size: 1.8rem;
        font-weight: 600;
      }

      /* Card grid */
      .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
        margin-bottom: 30px;
      }

      .card {
        background-color: var(--card-light);
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
      }

      body.dark-mode .card {
        background-color: var(--card-dark);
      }

      .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
      }

      .status-card {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      .status-info h3 {
        font-size: 1rem;
        margin-bottom: 5px;
        font-weight: 500;
      }

      .status-value {
        font-size: 2rem;
        font-weight: 700;
      }

      .status-icon {
        font-size: 2.5rem;
        color: var(--primary-color);
      }

      /* Control buttons */
      .control-buttons {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
      }

      .control-btn {
        border: none;
        background-color: #eaeaea;
        color: var(--text-light);
        border-radius: 10px;
        padding: 15px;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        transition: background-color 0.3s, transform 0.2s;
      }

      body.dark-mode .control-btn {
        background-color: #4a5568;
        color: var(--text-dark);
      }

      .control-btn:hover {
        transform: translateY(-3px);
      }

      .control-btn.active {
        background-color: var(--primary-color);
        color: white;
      }

      .control-btn-icon {
        font-size: 1.8rem;
        margin-bottom: 8px;
      }

      /* Device controls */
      .device-control {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 0;
        border-bottom: 1px solid var(--border-light);
      }

      body.dark-mode .device-control {
        border-bottom: 1px solid var(--border-dark);
      }

      .device-control:last-child {
        border-bottom: none;
      }

      .toggle-btn {
        position: relative;
        width: 60px;
        height: 30px;
        border-radius: 15px;
        background-color: #ccc;
        cursor: pointer;
        transition: background-color 0.3s;
      }

      .toggle-btn.active {
        background-color: var(--secondary-color);
      }

      .toggle-btn::after {
        content: "";
        position: absolute;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background-color: white;
        top: 2px;
        left: 2px;
        transition: transform 0.3s;
      }

      .toggle-btn.active::after {
        transform: translateX(30px);
      }

      /* Climate controls */
      .temp-control {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 30px 0;
      }

      .temp-display {
        font-size: 4rem;
        font-weight: 700;
        color: var(--primary-color);
        margin-bottom: 20px;
      }

      .temp-buttons {
        display: flex;
        gap: 15px;
      }

      .temp-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: none;
        background-color: #eaeaea;
        color: var(--text-light);
        font-size: 1.5rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.3s;
      }

      body.dark-mode .temp-btn {
        background-color: #4a5568;
        color: var(--text-dark);
      }

      .temp-btn:hover {
        background-color: #d1d1d1;
      }

      /* Progress bar */
      .progress-container {
        margin: 10px 0;
      }

      .progress-info {
        display: flex;
        justify-content: space-between;
        margin-bottom: 5px;
      }

      .progress-bar {
        height: 10px;
        background-color: #eaeaea;
        border-radius: 5px;
        overflow: hidden;
      }

      body.dark-mode .progress-bar {
        background-color: #4a5568;
      }

      .progress-fill {
        height: 100%;
        border-radius: 5px;
        transition: width 0.5s;
      }

      .progress-fill.temperature {
        background-color: var(--danger-color);
      }

      .progress-fill.humidity {
        background-color: var(--primary-color);
      }

      .progress-fill.air-quality {
        background-color: var(--secondary-color);
      }

      /* Security */
      .security-button {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 30px 0;
      }

      .security-toggle {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        border: none;
        background-color: var(--primary-color);
        color: white;
        font-size: 2.5rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 20px;
        transition: background-color 0.3s, transform 0.2s;
      }

      .security-toggle:hover {
        transform: scale(1.05);
      }

      .security-toggle.disabled {
        background-color: var(--danger-color);
      }

      .security-logs {
        max-height: 300px;
        overflow-y: auto;
      }

      .log-item {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 8px;
        background-color: #eaeaea;
      }

      body.dark-mode .log-item {
        background-color: #4a5568;
      }

      .log-header {
        display: flex;
        justify-content: space-between;
      }

      .log-time {
        font-size: 0.85rem;
        color: #888;
      }

      body.dark-mode .log-time {
        color: #bbb;
      }

      /* Footer */
      footer {
        text-align: center;
        padding: 20px 0;
        margin-top: 40px;
        font-size: 0.85rem;
        color: #888;
      }

      body.dark-mode footer {
        color: #bbb;
      }

      /* Responsive styles */
      @media (max-width: 768px) {
        .card-grid {
          grid-template-columns: 1fr;
        }

        .control-buttons {
          grid-template-columns: repeat(2, 1fr);
        }

        .nav-item {
          padding: 10px 15px;
        }

        .nav-item span {
          display: none;
        }

        .nav-icon {
          font-size: 1.5rem;
        }
      }